﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ledger
{
    public class LedgerLine
    {
        public string Description { get; set; }
        public decimal Budget { get; set; }
        public List<Transaction> Transactions { get; set; }
        public decimal ToDate
        {
            get
            {
                decimal total = 0.0m;

                foreach (Transaction t in this.Transactions)
                {
                    if (t.IsRefund)
                        total -= t.Amount;
                    else
                        total += t.Amount;
                }

                return total;
            }
        }
        public LedgerLine()
        {
            this.Transactions = new List<Transaction>();
        }
    }
}
